//
//  WorkingRecordCell.m
//  AppFrame
//
//  Created by GXJ on 2017/3/6.
//  Copyright © 2017年 GXJ. All rights reserved.
//

#import "WorkingRecordCell.h"

@implementation WorkingRecordCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *cellsign = @"WorkingRecordCell";
    WorkingRecordCell *cell  = [tableView dequeueReusableCellWithIdentifier:cellsign];
    if (cell ==nil) {
        cell  = [[WorkingRecordCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellsign];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.backgroundColor = BackgroundColor;
        
        _backView = [[UIView alloc]init];
        _backView.backgroundColor = [UIColor whiteColor];
        _backView.layer.cornerRadius = 8 * m6Scale;
        [self addSubview:_backView];
        
        _backView.layer.shadowColor = [UIColor blackColor].CGColor;//shadowColor阴影颜色
        _backView.layer.shadowOffset = CGSizeMake(0,0);
        _backView.layer.shadowOpacity = 0.2;//阴影透明度，默认0
        _backView.layer.shadowRadius = 8 * m6Scale;//阴影半径，默认3
        
        _titleLab = [[UILabel alloc]init];
        _titleLab.text = @"行驶证、驾驶证补办";
        _titleLab.textColor = APPColor;
        _titleLab.font = [UIFont systemFontOfSize:32 * m6Scale];
        _titleLab.textAlignment = NSTextAlignmentCenter;
        [_backView addSubview:_titleLab];
        
        _line1= [[UIView alloc]init];
        _line1.backgroundColor =APPColor;
        [_backView addSubview:_line1];
        
        _picture = [[UIImageView alloc]init];
        _picture.image = [UIImage imageNamed:@"办事记录03"];
        [_backView addSubview:_picture];
        
        _state1 = [self createLab];
        _state2 = [self createLab];
        _state3 = [self createLab];
        _time1 = [self createLab];
        _time2 = [self createLab];
        _time3 = [self createLab];
        
        _state1.text = @"提交";
        _state2.text = @"处理中";
        _state3.text = @"已完结";
        
        _time1.text = @"09-20";
        _time2.text = @"09-20";
        _time3.text = @"09-20";
        
        _line2 = [[UIView alloc]init];
        _line2.backgroundColor = [UIColor colorWithHexString:@"#f2f2f2"];
        [_backView addSubview:_line2];
        
        _updateLab = [[UILabel alloc]init];
        _updateLab.text = @"更新时间:09-22 14:34";
        _updateLab.font = [UIFont systemFontOfSize:24 * m6Scale];
        _updateLab.textColor = [UIColor colorWithHexString:@"#a2a2a2"];
        [_backView addSubview:_updateLab];
        
        _nameLab = [[UILabel alloc]init];
        _nameLab.text = @"郑州市车辆管理局";
        _nameLab.textColor = [UIColor colorWithHexString:@"#a2a2a2"];
        _nameLab.font = [UIFont systemFontOfSize:24 * m6Scale];
        _nameLab.textAlignment = 2;
        [_backView addSubview:_nameLab];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];

    _backView.frame = CGRectMake(40*m6Scale, 20*m6Scale, self.frame.size.width-80*m6Scale, 400*m6Scale);
    _titleLab.frame = CGRectMake(0, 0, _backView.frame.size.width, 100*m6Scale);
    _line1.frame = CGRectMake(0, 100*m6Scale, _backView.frame.size.width, 2*m6Scale);
    _picture.frame= CGRectMake((_backView.frame.size.width-240*m6Scale)/4+10*m6Scale, 148*m6Scale, _backView.frame.size.width-((_backView.frame.size.width-240*m6Scale)/4+20*m6Scale)*2, 36*m6Scale);
    
    _state1.frame = CGRectMake((_backView.frame.size.width-240*m6Scale)/4, 196*m6Scale, 80*m6Scale, 80*m6Scale);
    _state2.frame = CGRectMake((_backView.frame.size.width-240*m6Scale)/2+80*m6Scale, 196*m6Scale, 80*m6Scale, 80*m6Scale);
    _state3.frame = CGRectMake((_backView.frame.size.width-240*m6Scale)*3/4+160*m6Scale, 196*m6Scale, 80*m6Scale, 40*m6Scale);
    
    _time1.frame = CGRectMake((_backView.frame.size.width-240*m6Scale)/4, 238*m6Scale, 80*m6Scale, 80*m6Scale);
    _time2.frame = CGRectMake((_backView.frame.size.width-240*m6Scale)/2+80*m6Scale, 238*m6Scale, 80*m6Scale, 80*m6Scale);
    _time3.frame = CGRectMake((_backView.frame.size.width-240*m6Scale)*3/4+160*m6Scale, 238*m6Scale, 80*m6Scale, 80*m6Scale);
    
    _line2.frame = CGRectMake(0, 318*m6Scale, _backView.frame.size.width, 2*m6Scale);
    _updateLab.frame = CGRectMake(30*m6Scale, 320*m6Scale, _backView.frame.size.width,80*m6Scale);
    _nameLab.frame = CGRectMake(0, 320*m6Scale, _backView.frame.size.width-30*m6Scale, 80*m6Scale);
}
-(UILabel *)createLab{
    UILabel *label = [[UILabel alloc]init];
    label.font = [UIFont systemFontOfSize:24 * m6Scale];
    label.textAlignment = 1;
    label.textColor = [UIColor colorWithHexString:@"#a2a2a2"];
    [_backView addSubview:label];
    return label;
}
//-(void)setModel:(MyordersModel *)model
//{
//    _model = model;
//}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
